package lab01;

/**
 * Created by 阿阿阿阿豪丶 on 2017/9/30.
 */
public class Test05 {
    public static void main(String[] args) {
        For();
        While();
        Do_while();
    }

    static void For() {
        int sum = 0;
        for (int i = 1; i <= 999; i++) {
            sum += i;
        }
        System.out.println(sum);
    }

    static void While() {
        int sum = 0;
        int i = 1;
        while (i <= 999) {
            sum += i;
            i++;
        }
        System.out.println(sum);
    }

    static void Do_while() {
        int sum = 0;
        int i = 1;
        do {
            sum += i;
            i++;
        }
        while (i <= 999);
        System.out.println(sum);
    }
}
